from apiclient import discovery
from apiclient import model
import json

DEVELOPER_KEY = ''

model.JsonModel.alt_param = ""
freebase = discovery.build('freebase', 'v1', developerKey=DEVELOPER_KEY)
query = [{'id': None, 'name': None, 'type': '/film/film'}]

def do_query(cursor=""):

	response = json.loads(freebase.mqlread(query=json.dumps(query), cursor=cursor).execute())
	for item in response['result']:
		print item['name']

	return response.get("cursor")


cursor = do_query()
while(cursor):
	cursor = do_query(cursor)

